<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
        }
        .container{
            width: 400px;
            margin: 0 auto;
        }
        h1{
            text-align: center;
            margin-bottom: 30px;
        }
        p{
            text-align: center;
            color: gray;
            line-height: 50px;
        }
        .div1{
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .content{
            margin-bottom: 15px;
            height: 25px;
        }
        span{
            width: 70px;
            margin-bottom: 15px;
        }
        .submit{
            background-color: rgb(255,157,0);
            color: white;
            width: 260px;
            height: 30px;
            border: none;
            border-radius: 5px;
            margin-bottom: 20px;
        }
        .submit:active{
            background-color: gray;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>表白墙</h1>
        <p>输入后点击提交，会将信息显示在表格中<br></p>
        <div class="div1">
            <span>谁：</span>
            <input type="text" class="content">
        </div>
        <div class="div1">
            <span>对谁：</span>
            <input type="text" class="content">
        </div>
        <div class="div1">
            <span>说什么：</span>
            <input type="text" class="content">
        </div>
        <div class="div1">
            <input type="button" value="提交" class="submit" onclick="submit()">
        </div>
    </div>
</body>
<script>
    function submit(){
        let content = document.querySelectorAll(".content");
        let from = content[0].value;
        let to = content[1].value;
        let message = content[2].value;
        let div = document.createElement("div");
        div.className = "div1";
        div.innerHTML = from + " 对 " + to + " 说：" + message;
        let container = document.querySelector(".container");
        container.appendChild(div);
    }
</script>
</html>